package eu.fishcode.android;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import eu.fishcode.android.ui.MainWindow;
import eu.fishcode.android.ui.SplashScreen;
import eu.fishcode.android.utils.Configuration;
import eu.fishcode.android.utils.Utils;

public class BootAnimationEditor {

	public static void main(String[] args) {
		// Configurazione tema
		try {
			for (final LookAndFeelInfo info : UIManager
					.getInstalledLookAndFeels()) {
				if (Configuration.getString("settings.ui.theme").equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (final Exception e) {	}
		
		// Avvio schermata splash
		final SplashScreen splash = new SplashScreen();
		splash.setVisible(true);

		try {
			Thread.sleep(600);
		} catch (final InterruptedException e) {
		}

		// Avvio schermata principale
		final MainWindow mainWindow = new MainWindow();

		mainWindow.setSize(800, 600);
		mainWindow.setTitle(Utils.getLabel("title"));
		mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainWindow.setLocationRelativeTo(null);
		mainWindow.setVisible(true);
		
		try {
			Thread.sleep(1200);
		} catch (final InterruptedException e) {
		}
		
		// Chiusura schermata splash
		splash.setVisible(false);
		splash.dispose();
	}

}